#include <Windows.h>
#include "thread_guard.h"

thread_guard::thread_guard( long *m )
{
	_mutex = m;
	while (::InterlockedExchange(_mutex,1))
	{
		Sleep(0);
	}
}

thread_guard::~thread_guard()
{
	::InterlockedExchange(_mutex,0);
}